#
# import time
#
# timestamp = time.time()
# print("当前系统时间戳:", timestamp)
# # 转换为可读格式
# print("格式化后的时间:", time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(timestamp)))


from datetime import datetime, time, timedelta

from datetime import datetime, time
import time as tm

def wait_until_target_time(target_time_str="10:00:15"):
    """
    等待直到指定的时间（HH:MM:SS）到达后再继续执行
    """
    # 解析目标时间
    hour, minute, second = map(int, target_time_str.split(":"))
    target_time = time(hour=hour, minute=minute, second=second)

    while True:
        now = datetime.now().time()
        if now >= target_time:
            print(f"当前时间 {now}，已达到目标时间 {target_time}，开始执行任务")
            break
        # 每秒检查一次时间
        tm.sleep(10)
        print("等待中...")

def now_time():
    formatted_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    print("格式化后的时间：", formatted_time)
    return formatted_time


if __name__ == "__main__":
    # 示例用法
    wait_until_target_time("15:00:00")